// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_a.p_a;

import android.os.Environment;
import android.text.TextUtils;
import com.nnee.p_b.p_a.cls_d;
import com.nnee.p_fk.p_a.cls_j;
import com.nnee.p_fk.p_a.cls_m;
import com.nnee.p_g.cls_b;
import com.nnee.p_j.cls_f;
import com.nnee.p_k.cls_c;
import com.nnee.p_pr.p_a.cls_u;
import com.nnee.p_pr.p_b.cls_a;
import com.nnee.p_pr.p_c.cls_i;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.zip.GZIPOutputStream;
import org.apache.http.Header;
import org.apache.http.HttpResponse;

// Referenced classes of package com.nnee.a.a:
//            g, d, b

public final class cls_e {

	public cls_e() {
	}

	private static int a(InputStream inputstream, OutputStream outputstream,
			int i1, cls_f f1) throws IOException {
		long l1;
		byte abyte0[];
		int j1;
		int k1;
		int i2;

		int j2;
		byte abyte1[] = new byte[4096];
		int i3 = 0;

		long l2;

		int j3=0;
		if (i1 <= 0) {
			l1 = System.currentTimeMillis();
			abyte0 = new byte[4096];
			j1 = 0;
			k1 = 0;
			i2 = 0;
			while (true) {
				if (f1.a())
					break;
				try {
					i2 = inputstream.read(abyte0, j1, abyte0.length - j1);
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				l2 = System.currentTimeMillis();
				if (i2 >= 0) {
					if (i2 != 0)
						break;
					if (l2 - l1 <= 5000L) {
						continue;
					} else {
						j2 = i2;
						if (j1 > 0)
							try {
								outputstream.write(abyte0, 0, j1);
							} catch (IOException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							}
						if (f1.a())
							throw new IOException("http closed");
						return j2;
					}
				} else {
					j2 = i2;
				}
			}
		} else {
			for (j2 = 0; j2 < i1 && !f1.a();) {
				
				try {
					j3 = inputstream.read(abyte1, i3,
							Math.min(abyte1.length - i3, i1 - j2));
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				i3 += j3;
				if (j3 == -1)
					throw new IOException(
							"http readData from stream num mismatch");
				if (i3 == 4096) {
					try {
						outputstream.write(abyte1, 0, 4096);
					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					j2 += j3;
					i3 = 0;
				} else {
					j2 += j3;
				}
			}

			if (f1.a())
				throw new IOException("http closed");
			if (i3 > 0)
				try {
					outputstream.write(abyte1, 0, i3);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

			return j2;
		}
		return i3;

	}

	public static cls_g a(cls_m m1, HttpResponse httpresponse,
			InputStream inputstream, int i1, cls_f f1) {
		return null;
		// cls_g g1 = null;
		// long l1 = System.currentTimeMillis();
		// String s1 = m1.v();
		// if(httpresponse != null && s1 != null)
		// {
		// Object obj;
		// g g2;
		// if(httpresponse.getFirstHeader("content-encoding") == null)
		// obj = g1;
		// else
		// obj = httpresponse.getFirstHeader("content-encoding").getValue();
		// if(!m1.x())
		// {
		// Object obj2;
		// Object obj3;
		// Object obj4;
		// Object obj5;
		// if(httpresponse.getFirstHeader("expires") == null)
		// obj2 = g1;
		// else
		// obj2 = httpresponse.getFirstHeader("expires").getValue();
		// if(httpresponse.getFirstHeader("last-modified") == null)
		// obj3 = g1;
		// else
		// obj3 = httpresponse.getFirstHeader("last-modified").getValue();
		// if(httpresponse.getFirstHeader("etag") == null)
		// obj4 = g1;
		// else
		// obj4 = httpresponse.getFirstHeader("etag").getValue();
		// if(httpresponse.getFirstHeader("cache-control") == null)
		// obj5 = g1;
		// else
		// obj5 = httpresponse.getFirstHeader("cache-control").getValue();
		// g2 = a(((String) (obj2)), ((String) (obj3)), ((String) (obj4)),
		// ((String) (obj5)));
		// } else
		// {
		// g2 = new cls_g();
		// }
		// if(g2 == null)
		// {
		// g1 = g2;
		// } else
		// {
		// while (true}
		// {
		// a(s1, g2, m1.A());
		// long l2;
		// File file;
		// IOException ioexception;
		// long l3;
		// Exception exception;
		// Object obj1;
		// IOException ioexception1;
		// IOException ioexception2;
		// IOException ioexception3;
		// long l4;
		// IOException ioexception4;
		// if(com.nnee.p_pr.p_app.cls_e.d)
		// {
		// com.nnee.p_g.cls_b.d("cache create", (new
		// StringBuilder()).append("cache create setupFiles ").append(System.currentTimeMillis()
		// - l1).toString());
		// l2 = System.currentTimeMillis();
		// } else
		// {
		// l2 = l1;
		// }
		// file = new File(g2.e());
		// if(file.exists())
		//
		// a(g2);
		// }
		// }
		// }
		// return g1;
		// if(com.nnee.p_pr.p_app.cls_e.d)
		// {
		// com.nnee.p_g.cls_b.d("cache create", (new
		// StringBuilder()).append("cache create checkfile ").append(System.currentTimeMillis()
		// - l2).toString());
		// l2 = System.currentTimeMillis();
		// }
		// g2.b(((String) (obj)));
		// if(inputstream == null) goto _L2; else goto _L1
		// _L1:
		// l3 = i1;
		// if(!a(l3))
		// throw new com.nnee.p_a.p_a.cls_d();
		// goto _L3
		// ioexception2;
		// obj1 = g1;
		// _L6:
		// ioexception2.printStackTrace();
		// if(obj1 != null)
		// try
		// {
		// ((OutputStream) (obj1)).close();
		// }
		// // Misplaced declaration of an exception variable
		// catch(IOException ioexception3) { }
		// c(file);
		// a(file);
		// a(g2);
		// break MISSING_BLOCK_LABEL_23;
		// _L3:
		// if(!com.nnee.p_pr.app.e.d)
		// break MISSING_BLOCK_LABEL_659;
		// com.nnee.p_g.cls_b.d("cache create", (new
		// StringBuilder()).append("cache create checkspace ").append(System.currentTimeMillis()
		// - l2).toString());
		// l4 = System.currentTimeMillis();
		// _L7:
		// obj1 = new FileOutputStream(file);
		// if(m1.y() && !"gzip".equals(obj))
		// obj1 = new GZIPOutputStream(((OutputStream) (obj1)));
		// if(obj1 != null)
		// g2.b(a(inputstream, ((OutputStream) (obj1)), i1, f1));
		// if(com.nnee.p_pr.p_app.cls_e.d)
		// {
		// com.nnee.p_g.cls_b.d("cache create", (new
		// StringBuilder()).append("cache create createfile ").append(System.currentTimeMillis()
		// - l4).toString());
		// System.currentTimeMillis();
		// }
		// if(obj1 != null)
		// try
		// {
		// ((OutputStream) (obj1)).close();
		// }
		// // Misplaced declaration of an exception variable
		// catch(IOException ioexception4) { }
		// c(file);
		// g1 = g2;
		// break MISSING_BLOCK_LABEL_23;
		// _L2:
		// if(g1 != null)
		// try
		// {
		// null.close();
		// }
		// // Misplaced declaration of an exception variable
		// catch(IOException ioexception) { }
		// c(file);
		// break MISSING_BLOCK_LABEL_413;
		// exception;
		// obj1 = g1;
		// _L5:
		// if(obj1 != null)
		// try
		// {
		// ((OutputStream) (obj1)).close();
		// }
		// // Misplaced declaration of an exception variable
		// catch(IOException ioexception1) { }
		// c(file);
		// throw exception;
		// exception;
		// if(true) goto _L5; else goto _L4
		// _L4:
		// ioexception2;
		// goto _L6
		// l4 = l2;
		// goto _L7
	}

	private static cls_g a(String s1, String s2, String s3, String s4) {
		cls_g g1=null;
		cls_g g2=null;
		String as[];
		int i1;
		g1 = new cls_g();
		g1.c(-1L);
		g1.d(s1);
		if (com.nnee.p_pr.p_app.cls_e.d)
			com.nnee.p_g.cls_b.e("CacheManagerEx", (new StringBuilder())
					.append("expiresString is:").append(g1.g()).toString());
		if (s2 != null)
			g1.e(s2);
		else
			g1.e(b(System.currentTimeMillis()));
		if (s3 != null)
			g1.c(s3);
		if (g1.g() != null)
			if (g1.g().length() <= 2)
				g1.c(0L);
			else
				try {
					g1.c(n().parse(g1.g()).getTime());
				} catch (ParseException parseexception) {
					parseexception.printStackTrace();
					if (com.nnee.p_pr.p_app.cls_e.d)
						com.nnee.p_g.cls_b.d(
								"CacheManagerEx",
								(new StringBuilder())
										.append("illegal expires: ")
										.append(g1.g()).toString());
				}
		if (s4 == null)
			return g2;
		as = s4.toLowerCase().split("[ ,;]");
		i1 = 0;
		while (true) {
			if (i1 >= as.length)
				break;
			if (!"no-store".equals(as[i1])) {
				if ("no-cache".equals(as[i1]))
					g1.c(0L);
				else if (as[i1].startsWith("max-age")) {
					int j1 = as[i1].indexOf('=');
					if (j1 < 0)
						j1 = as[i1].indexOf(':');
					if (j1 > 0) {
						String s5 = as[i1].substring(j1 + 1);
						try {
							long l1 = Long.parseLong(s5);
							if (l1 >= 0L)
								g1.c(System.currentTimeMillis() + l1 * 1000L);
						} catch (NumberFormatException numberformatexception) {
							if ("1d".equals(s5)) {
								g1.c(0x5265c00L + System.currentTimeMillis());
							} else {
								if (com.nnee.p_pr.p_app.cls_e.d)
									com.nnee.p_g.cls_b
											.d("CacheManagerEx",
													(new StringBuilder())
															.append("exception in parseHeaders for max-age:")
															.append(as[i1]
																	.substring(j1 + 1))
															.toString());
								g1.c(0L);
							}
						}
					}
				}
				i1++;
			} else {
				return g2;
			}
		}
		g2 = g1;
		return g2;

	}

	public static cls_g a(String s1, String s2, boolean flag) {
		return a(s1, s2, flag, true);
	}

	public static cls_g a(String s1, String s2, boolean flag, boolean flag1) {
		cls_g g1 = null;
		if (s2 != null) {
			long l1 = System.currentTimeMillis();
			cls_g g2 = com.nnee.p_pr.p_c.cls_i.a(
					com.nnee.p_b.p_a.cls_d.h().a(), s1, s2);
			if (g2 != null) {
				if (g2.d() == 0L) {
					a(g2);
					if (com.nnee.p_pr.p_app.cls_e.d)
						com.nnee.p_g.cls_b
								.d("cache get ",
										(new StringBuilder())
												.append("cache get > ")
												.append(System
														.currentTimeMillis()
														- l1).toString());
					return g1;
				}
				File file = new File(g2.e());
				if (!file.exists()) {
					a(g2);
					if (com.nnee.p_pr.p_app.cls_e.d)
						com.nnee.p_g.cls_b
								.d("cache get ",
										(new StringBuilder())
												.append("cache get > ")
												.append(System
														.currentTimeMillis()
														- l1).toString());
					return g1;
				}
				if (flag1) {
					if (flag && !g2.c()) {
						File file1 = new File(g());
						if (!file1.exists())
							file1.mkdirs();
						File file2 = new File(file1, file.getName());
						if (a(file, file2)) {
							g2.a(file2.getPath());
							g2.a(true);
							com.nnee.p_pr.p_c.cls_i.a(com.nnee.p_b.p_a.cls_d
									.h().a(), s2, g2);
							com.nnee.p_fk.cls_m.a().a(null, g2);
							g1 = g2;
							return g1;
						}
					}
					com.nnee.p_fk.cls_m.a().a(s2, g2);
				}
				if (com.nnee.p_pr.p_app.cls_e.d)
					com.nnee.p_g.cls_b.d("cache get ",
							(new StringBuilder()).append("cache get > ")
									.append(System.currentTimeMillis() - l1)
									.toString());
				g1 = g2;
			} else if (com.nnee.p_pr.p_app.cls_e.d)
				com.nnee.p_g.cls_b.d(
						"cache get ",
						(new StringBuilder()).append("cache get > ")
								.append(System.currentTimeMillis() - l1)
								.toString());
			return g1;
		} else
			return g1;

	}

	public static String a(String s1, boolean flag) {
		String s2 = null;
		long l1 = System.currentTimeMillis();
		if (!flag) {
			File file2 = new File(f(), s1);
			if (file2.exists()) {
				String s5 = file2.getPath();
				com.nnee.p_fk.cls_m.a().a(s1, s5);
				if (com.nnee.p_pr.p_app.cls_e.d)
					com.nnee.p_g.cls_b.d("getLocalFile",
							(new StringBuilder()).append(" local time > ")
									.append(System.currentTimeMillis() - l1)
									.toString());
				s2 = file2.getPath();
				return s2;
			}
			if (com.nnee.p_pr.p_app.cls_e.d)
				com.nnee.p_g.cls_b.d(
						"getLocalFile",
						(new StringBuilder())
								.append(" local time internal 1 > ")
								.append(System.currentTimeMillis() - l1)
								.toString());
			File file3 = new File(g(), s1);
			if (file3.exists()) {
				String s4 = file3.getPath();
				com.nnee.p_fk.cls_m.a().a(s1, s4);
				if (com.nnee.p_pr.p_app.cls_e.d)
					com.nnee.p_g.cls_b.d("getLocalFile",
							(new StringBuilder()).append(" local time > ")
									.append(System.currentTimeMillis() - l1)
									.toString());
				s2 = file3.getPath();
				return s2;
			}
			if (com.nnee.p_pr.p_app.cls_e.d)
				com.nnee.p_g.cls_b.d(
						"getLocalFile",
						(new StringBuilder())
								.append(" local time internal 2 > ")
								.append(System.currentTimeMillis() - l1)
								.toString());

		} else {
			File file = new File(g(), s1);
			if (!file.exists()) {
				File file1 = new File(f(), s1);
				if (file1.exists()) {
					s2 = (new StringBuilder()).append(f()).append("/")
							.append(s1).toString();
					file1.renameTo(new File(s2));
					com.nnee.p_fk.cls_m.a().a(s1, s2);
					if (com.nnee.p_pr.p_app.cls_e.d)
						com.nnee.p_g.cls_b
								.d("getLocalFile",
										(new StringBuilder())
												.append(" local time > ")
												.append(System
														.currentTimeMillis()
														- l1).toString());
					return s2;
				}

				if (com.nnee.p_pr.p_app.cls_e.d)
					com.nnee.p_g.cls_b.d("getLocalFile",
							(new StringBuilder()).append(" local time > ")
									.append(System.currentTimeMillis() - l1)
									.toString());
				s2 = null;

				return s2;
			} else {

				String s3 = file.getPath();
				com.nnee.p_fk.cls_m.a().a(s1, s3);
				if (com.nnee.p_pr.p_app.cls_e.d)
					com.nnee.p_g.cls_b.d("getLocalFile",
							(new StringBuilder()).append(" local time > ")
									.append(System.currentTimeMillis() - l1)
									.toString());
				s2 = file.getPath();
				return s2;
			}
		}
		return s2;

	}

	public static void a() {
		if (y.isEmpty()) {
			com.nnee.p_a.p_a.cls_b b1 = new com.nnee.p_a.p_a.cls_b();
			a(u, 0x6400000, ((com.nnee.p_k.cls_a) (b1)));
			a(v, 0x6400000, ((com.nnee.p_k.cls_a) (b1)));
			long l1 = com.nnee.p_pr.p_b.cls_a.b(0x6400000L);
			a(w, 0x10000000, l1, ((com.nnee.p_k.cls_a) (b1)));
			a(x, 0x10000000, l1, ((com.nnee.p_k.cls_a) (b1)));
		}
		if (!com.nnee.p_pr.p_a.cls_e.a()) {
			File file1 = new File(v);
			if (!file1.exists() && !file1.mkdirs())
				com.nnee.p_g.cls_b.f("CacheManagerEx",
						"Unable to create cache directory");
		} else {
			File file = new File(u);
			if (!file.exists() && !file.mkdirs())
				com.nnee.p_g.cls_b.f("CacheManagerEx",
						"Unable to create cache directory");
		}

	}

	public static void a(cls_g g1) {
		if (g1 != null) {
			if (g1.e() != null)
				a(new File(g1.e()));
			com.nnee.p_pr.p_c.cls_i.b(com.nnee.p_b.p_a.cls_d.h().a(),
					com.nnee.p_b.p_a.cls_d.h().c(), g1);
			g1.n();
		}
	}

	public static void a(cls_m m1, cls_j j1, InputStream inputstream, int i1,
			boolean flag, cls_f f1) {
		// Object obj;
		// cls_g g1;
		// String s1;
		// Object obj1;
		// Object obj2;
		// Object obj3;
		// Object obj4;
		// Object obj5;
		// g g2;
		// obj = null;
		// HttpResponse httpresponse = j1.d();
		// g1 = j1.b();
		// s1 = m1.v();
		// if(httpresponse != null && s1 != null)
		// if(g1 == null)
		// {
		// g g3 = a(m1, httpresponse, inputstream, i1, f1);
		// if(!m1.x())
		// a(s1, g3);
		// } else
		// {
		// while(true)
		// {
		// if(httpresponse.getFirstHeader("expires") == null)
		// obj1 = obj;
		// else
		// obj1 = httpresponse.getFirstHeader("expires").getValue();
		// if(httpresponse.getFirstHeader("last-modified") == null)
		// obj2 = obj;
		// else
		// obj2 = httpresponse.getFirstHeader("last-modified").getValue();
		// if(httpresponse.getFirstHeader("etag") == null)
		// obj3 = obj;
		// else
		// obj3 = httpresponse.getFirstHeader("etag").getValue();
		// if(httpresponse.getFirstHeader("cache-control") == null)
		// obj4 = obj;
		// else
		// obj4 = httpresponse.getFirstHeader("cache-control").getValue();
		// if(httpresponse.getFirstHeader("content-encoding") == null)
		// obj5 = obj;
		// else
		// obj5 = httpresponse.getFirstHeader("content-encoding").getValue();
		// g2 = a(((String) (obj1)), ((String) (obj2)), ((String) (obj3)),
		// ((String) (obj4)));
		// if(g2 != null)
		// continue;
		// a(g1);
		// }
		// }
		// while (true){
		// if(!TextUtils.isEmpty(((CharSequence) (obj3))))
		// g1.c(g2.i());
		// if(!TextUtils.isEmpty(((CharSequence) (obj4))) ||
		// !TextUtils.isEmpty(((CharSequence) (obj1))))
		// g1.c(g2.f());
		// if(!TextUtils.isEmpty(((CharSequence) (obj1))))
		// g1.d(g2.g());
		// if(!TextUtils.isEmpty(((CharSequence) (obj2))))
		// g1.e(g2.h());
		// g2.n();
		// if(!flag) {
		// com.nnee.p_pr.p_c.cls_i.a(com.nnee.p_b.p_a.cls_d.h().a(),
		// com.nnee.p_b.p_a.cls_d.h().c(), s1, g1);
		// } else
		// {
		// g1.b(((String) (obj5)));
		// a(s1, g1, g1.c());
		// if(g1.e() == null) {} else {
		// File file = new File(g1.e());
		// if(inputstream == null) {
		// if(obj != null)
		// try
		// {
		// ((OutputStream) (obj)).close();
		// }
		// // Misplaced declaration of an exception variable
		// catch(IOException ioexception) { }
		// c(new File(g1.e()));
		// }
		// else {
		// long l1 = i1;
		// if(!a(l1))
		// throw new com.nnee.p_a.p_a.cls_d();
		// goto _L7
		// }
		// }
		// }
		// }
		// _L1:
		// g1.b(((String) (obj5)));
		// a(s1, g1, g1.c());
		// if(g1.e() == null) goto _L4; else goto _L3
		// _L3:
		// File file = new File(g1.e());
		// if(inputstream == null) {
		// if(obj != null)
		// try
		// {
		// ((OutputStream) (obj)).close();
		// }
		// // Misplaced declaration of an exception variable
		// catch(IOException ioexception) { }
		// c(new File(g1.e()));
		// } else {
		//
		// }
		// _L5:
		// long l1 = i1;
		// if(!a(l1))
		// throw new com.nnee.p_a.p_a.cls_d();
		// goto _L7
		// IOException ioexception2;
		// ioexception2;
		// _L10:
		// ioexception2.printStackTrace();
		// Exception exception;
		// FileOutputStream fileoutputstream;
		// IOException ioexception;
		// long l2;
		// if(obj != null)
		// try
		// {
		// ((OutputStream) (obj)).close();
		// }
		// catch(IOException ioexception3) { }
		// c(new File(g1.e()));
		// a(g1);
		// goto _L4
		// _L7:
		// if(!file.exists())
		// break MISSING_BLOCK_LABEL_510;
		// fileoutputstream = new FileOutputStream(file, false);
		// if(!m1.y() || "gzip".equals(obj5))
		// break MISSING_BLOCK_LABEL_704;
		// obj = new GZIPOutputStream(fileoutputstream);
		// _L11:
		// if(obj == null) goto _L6; else goto _L8
		// _L8:
		// g1.b(a(inputstream, ((OutputStream) (obj)), i1, f1));
		// l2 = System.currentTimeMillis();
		// com.nnee.p_pr.p_c.cls_i.a(com.nnee.p_b.p_a.cls_d.h().a(),
		// com.nnee.p_b.p_a.cls_d.h().c(), s1, g1);
		// if(com.nnee.p_pr.p_app.cls_e.d)
		// com.nnee.p_g.cls_b.d("cache update ", (new
		// StringBuilder()).append("cache update > ").append(System.currentTimeMillis()
		// - l2).toString());
		// _L6:
		// if(obj != null)
		// try
		// {
		// ((OutputStream) (obj)).close();
		// }
		// // Misplaced declaration of an exception variable
		// catch(IOException ioexception) { }
		// c(new File(g1.e()));
		// goto _L4
		// exception;
		// _L9:
		// if(obj != null)
		// try
		// {
		// ((OutputStream) (obj)).close();
		// }
		// catch(IOException ioexception1) { }
		// c(new File(g1.e()));
		// throw exception;
		// _L2:
		// com.nnee.p_pr.p_c.cls_i.a(com.nnee.p_b.p_a.cls_d.h().a(),
		// com.nnee.p_b.p_a.cls_d.h().c(), s1, g1);
		// goto _L4
		// exception;
		// obj = fileoutputstream;
		// goto _L9
		// ioexception2;
		// obj = fileoutputstream;
		// goto _L10
		// obj = fileoutputstream;
		// goto _L11
	}

	public static void a(String s1) {
		com.nnee.p_k.cls_e e1 = (com.nnee.p_k.cls_e) y.get(s1);
		if (e1 != null)
			e1.a(true);
	}

	private static void a(String s1, int i1, long l1, com.nnee.p_k.cls_a a1) {
		com.nnee.p_k.cls_e e1 = new com.nnee.p_k.cls_e(s1, i1, false, l1, a1);
		y.put(s1, e1);
	}

	private static void a(String s1, int i1, com.nnee.p_k.cls_a a1) {
		com.nnee.p_k.cls_e e1 = new com.nnee.p_k.cls_e(s1, i1, true, 0L, a1);
		y.put(s1, e1);
	}

	public static void a(String s1, cls_g g1) {
		if (g1 != null && s1 != null && g1.e() != null) {
			File file = new File(g1.e());
			if (!file.exists()) {
				if (com.nnee.p_pr.p_app.cls_e.d)
					com.nnee.p_g.cls_b
							.e("CacheManagerEx",
									(new StringBuilder())
											.append("***********not save cache url is:")
											.append(s1).toString());
			} else {
				g1.b(file.length());
				if (g1.d() == 0L && !g1.m())
					com.nnee.p_g.cls_b.e(
							"CacheManagerEx",
							(new StringBuilder()).append(g1.e())
									.append(" delete failed.").toString());
				long l1 = System.currentTimeMillis();
				com.nnee.p_pr.p_c.cls_i.a(com.nnee.p_b.p_a.cls_d.h().a(),
						com.nnee.p_b.p_a.cls_d.h().c(), s1, g1);
				if (com.nnee.p_pr.p_app.cls_e.d) {
					com.nnee.p_g.cls_b.d("cache save ",
							(new StringBuilder()).append("cache save > ")
									.append(System.currentTimeMillis() - l1)
									.toString());
					com.nnee.p_g.cls_b.c(
							"CacheManagerEx",
							(new StringBuilder())
									.append("saveCacheFile for url ")
									.append(s1).toString());
				}
				g1.n();
			}
			return;
		} else {
			if (com.nnee.p_pr.p_app.cls_e.d)
				com.nnee.p_g.cls_b.e("CacheManagerEx", (new StringBuilder())
						.append("***********not save cache url is:").append(s1)
						.toString());
			return;
		}

	}

	private static void a(String s1, cls_g g1, boolean flag)
			throws com.nnee.p_a.p_a.cls_d, cls_c {
		long l3;
		File file1;
		if (com.nnee.p_pr.p_app.cls_e.d)
			com.nnee.p_g.cls_b.e(
					"CacheManageEx",
					(new StringBuilder()).append("setupFiles url is: ")
							.append(s1).toString());
		long l1 = System.currentTimeMillis();
		if (!i())
			throw new com.nnee.p_a.p_a.cls_d();
		if (com.nnee.p_pr.p_app.cls_e.d)
			com.nnee.p_g.cls_b
					.d("setup files",
							(new StringBuilder())
									.append("setup file chechspace ")
									.append(System.currentTimeMillis() - l1)
									.toString());
		long l2 = System.currentTimeMillis();
		String s2;
		File file;
		if (flag)
			s2 = g();
		else
			s2 = f();
		file = new File(s2);
		if (!file.exists())
			file.mkdirs();
		if (com.nnee.p_pr.p_app.cls_e.d)
			com.nnee.p_g.cls_b
					.d("setup files",
							(new StringBuilder())
									.append("setup file chechdir ")
									.append(System.currentTimeMillis() - l2)
									.toString());
		l3 = System.currentTimeMillis();
		file1 = new File(s2, s1);
		if (!file1.exists()) {
			try {
				if (com.nnee.p_pr.p_app.cls_e.d) {
					com.nnee.p_g.cls_b.d("setup files",
							(new StringBuilder()).append("setup file delete ")
									.append(System.currentTimeMillis() - l3)
									.toString());
					l3 = System.currentTimeMillis();
				}
				file1.createNewFile();
			} catch (IOException ioexception) {
				ioexception.printStackTrace();
				a();
				try {
					file1.createNewFile();
				} catch (IOException ioexception1) {
					ioexception1.printStackTrace();
					throw new cls_c();
				}

			}
		} else {
			b(file1);
		}

		if (com.nnee.p_pr.p_app.cls_e.d) {
			com.nnee.p_g.cls_b
					.d("setup files",
							(new StringBuilder())
									.append("setup file recreate ")
									.append(System.currentTimeMillis() - l3)
									.toString());
			System.currentTimeMillis();
		}
		g1.a((new StringBuilder()).append(s2).append(File.separator).append(s1)
				.toString());
		g1.a(flag);
		return;

	}

	public static boolean a(long l1) {
		return com.nnee.p_pr.p_a.cls_u.a(o(), l1);
	}

	public static boolean a(File file) {
		boolean flag;
		if (file.exists()) {
			com.nnee.p_k.cls_e e1 = (com.nnee.p_k.cls_e) y
					.get(file.getParent());
			if (e1 != null) {
				flag = e1.b(file);
			} else {
				if (com.nnee.p_pr.p_app.cls_e.d)
					com.nnee.p_g.cls_b.b(
							"cachemex",
							(new StringBuilder())
									.append("deleteFile not find observer:")
									.append(file.getParent()).toString());
				flag = file.delete();
			}
		} else {
			flag = false;
		}
		return flag;
	}

	public static boolean a(File file, File file1) {
		boolean flag;
		if (file.exists()) {
			com.nnee.p_k.cls_e e1 = (com.nnee.p_k.cls_e) y
					.get(file.getParent());
			if (e1 != null) {
				boolean flag1 = e1.a(file, file1);
				if (flag1) {
					com.nnee.p_k.cls_e e2 = (com.nnee.p_k.cls_e) y.get(file1
							.getParent());
					if (e2 != null)
						e2.a(file1);
				}
				flag = flag1;
			} else {
				if (com.nnee.p_pr.p_app.cls_e.d)
					com.nnee.p_g.cls_b.b(
							"cachemex",
							(new StringBuilder())
									.append("renameFile not find observer:")
									.append(file.getParent()).toString());
				flag = file.renameTo(file1);
			}
		} else {
			flag = false;
		}
		return flag;
	}

	public static cls_g b(String s1, boolean flag) {
		return a(null, s1, flag);
	}

	public static String b() {
		return u;
	}

	static String b(long l1) {
		Date date = new Date(l1);
		return n().format(date);
	}

	public static void b(File file) {
		com.nnee.p_k.cls_e e1 = (com.nnee.p_k.cls_e) y.get(file.getParent());
		if (e1 != null)
			e1.c(file);
	}

	public static void b(String s1) {
		com.nnee.p_k.cls_e e1 = (com.nnee.p_k.cls_e) y.get(s1);
		if (e1 != null)
			e1.a(false);
	}

	public static String c() {
		return v;
	}

	public static void c(File file) {
		if (file.exists()) {
			com.nnee.p_k.cls_e e1 = (com.nnee.p_k.cls_e) y
					.get(file.getParent());
			if (e1 != null)
				e1.a(file);
		}
	}

	public static void c(String s1) {
		if (s1 != null) {
			com.nnee.p_k.cls_e e1 = (com.nnee.p_k.cls_e) y.get(s1);
			if (e1 != null) {
				e1.a(0x6400000L);
				e1.a();
			}
			if (s1.equals(w)) {
				com.nnee.p_k.cls_e e2 = (com.nnee.p_k.cls_e) y.get(x);
				if (e2 != null) {
					e2.a(0x6400000L);
					e2.a();
				}
				com.nnee.p_pr.p_b.cls_a.a(0x6400000L);
			}
		}
	}

	public static cls_g d(String s1) {
		return b(s1, false);
	}

	public static String d() {
		return w;
	}

	public static cls_g e(String s1) {
		return a(((String) (null)), s1, false, false);
	}

	public static String e() {
		return x;
	}

	public static cls_g f(String s1) {
		cls_g g1 = null;
		if (s1 != null)
			g1 = com.nnee.p_pr.p_c.cls_i.a(com.nnee.p_b.p_a.cls_d.h().a(),null,
					s1);
		return g1;
	}

	public static String f() {
		String s1;
		if (com.nnee.p_pr.p_a.cls_e.a())
			s1 = u;
		else
			s1 = v;
		return s1;
	}

	public static String g() {
		String s1;
		if (com.nnee.p_pr.p_a.cls_e.a())
			s1 = w;
		else
			s1 = x;
		return s1;
	}

	public static String h() {
		String s1;
		if (com.nnee.p_pr.p_a.cls_e.a())
			s1 = (new StringBuilder())
					.append(Environment.getExternalStorageDirectory()
							.toString()).append("/").append("p_pr").toString();
		else
			s1 = (new StringBuilder()).append(Environment.getDataDirectory())
					.append("/data/").append("com.nnee.p_pr").toString();
		return s1;
	}

	public static boolean i() {
		return com.nnee.p_pr.p_a.cls_u.a(o(), 0x300000L);
	}

	static String j() {
		return w;
	}

	static String k() {
		return x;
	}

	static String l() {
		return u;
	}

	static String m() {
		return v;
	}

	private static DateFormat n() {
		if (t == null) {
			DateFormatSymbols dateformatsymbols = new DateFormatSymbols(
					Locale.ENGLISH);
			t = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z");
			t.setDateFormatSymbols(dateformatsymbols);
		}
		return t;
	}

	private static String o() {
		String s1;
		if (com.nnee.p_pr.p_a.cls_e.a())
			s1 = Environment.getExternalStorageDirectory().toString();
		else
			s1 = (new StringBuilder()).append(Environment.getDataDirectory())
					.append("/data/").toString();
		return s1;
	}

	static final String a = "if-modified-since";
	static final String b = "if-none-match";
	public static final String c = "content-type";
	public static final String d = "content-encoding";
	public static final String e = "expires";
	public static final String f = "cache-control";
	public static final String g = "last-modified";
	public static final String h = "etag";
	private static final int i = 4096;
	private static final boolean j = true;
	private static final int k = 0x6400000;
	private static final int l = 0x10000000;
	private static final int m = 0x6400000;
	private static final int n = 0x3200000;
	private static final String o = "CacheManagerEx";
	private static final int p = 0x300000;
	private static final String q = "no-store";
	private static final String r = "no-cache";
	private static final String s = "max-age";
	private static SimpleDateFormat t = null;
	private static String u = (new StringBuilder())
			.append(Environment.getExternalStorageDirectory().toString())
			.append("/").append("p_pr").append("/cache").toString();
	private static String v = (new StringBuilder())
			.append(Environment.getDataDirectory()).append("/data/")
			.append("com.nnee.p_pr").append("/cache").toString();
	private static String w = (new StringBuilder())
			.append(Environment.getExternalStorageDirectory().toString())
			.append("/").append("p_pr").append("/offcache").toString();
	private static String x = (new StringBuilder())
			.append(Environment.getDataDirectory()).append("/data/")
			.append("com.nnee.p_pr").append("/offcache").toString();
	private static HashMap y = new HashMap();

	static {
		a();
	}
}
